define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'apply.luck_draw/index',
        add_url: 'apply.luck_draw/add',
        edit_url: 'apply.luck_draw/edit',
        delete_url: 'apply.luck_draw/delete',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                defaultToolbar:['filter', {
                    title: '搜索',
                    layEvent: 'TABLE_SEARCH',
                    icon: 'layui-icon-search',
                    extend: 'data-table-id="' + 'user_sign' + '"'
                }],
                cols: [[
                    {type: "checkbox"},
                    {field: 'name', minWidth: 80, title: '名称'},
                    {field: 'images', minWidth: 80, title: '图片',search:false, templet: ea.table.image},
                    {field: 'create_time', minWidth: 80, title: '创建时间',search: 'range'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                    }
                ]],
            });

            

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        record :function () {
            ea.table.render({
                init: {
                    table_elem: '#currentTable',
                    table_render_id: 'currentTableRenderId',
                    index_url: 'apply.luck_draw/record',
                    add_url: 'apply.luck_draw/add',
                    edit_url: 'apply.luck_draw/edit',
                    delete_url: 'apply.luck_draw/delete',
                },
                toolbar : [],
                defaultToolbar:['filter', {
                    title: '搜索',
                    layEvent: 'TABLE_SEARCH',
                    icon: 'layui-icon-search',
                    extend: 'data-table-id="' + 'luck_record' + '"'
                }],
                cols: [[
                    {type: "checkbox"},
                    {field: 'username', minWidth: 80, title: '抽奖用户'},
                    {field: 'roomid', minWidth: 80, title: '房间',search:false},
                    {field: 'luck_name', minWidth: 80, title: '抽奖结果'},
                    {field: 'create_time', minWidth: 80, title: '抽奖时间',search: 'range'},
                ]],
            });
        }

    };
    return Controller;
});